package com.ssl.order.pay.facade;

import com.ssl.order.pay.factory.PayContextFactory;
import com.ssl.order.pay.strategy.PayContext;
import com.ssl.order.pojo.OrderSubmitRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * 支付门面类
 */
@Component
public class PayFacade {
    @Autowired
    PayContextFactory payContextFactory;

    public String pay(OrderSubmitRequest order,Integer payType){
        PayContext context = payContextFactory.getContext(payType);
        return context.execute(order);
    }
}
